package com.swind.fast.modules.app.halali.customer.controller;

import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.swind.fast.common.api.vo.Result;
import com.swind.fast.common.system.query.QueryGenerator;
import com.swind.fast.common.util.oConvertUtils;
import com.swind.fast.common.constant.CommonConstant;
import com.swind.fast.modules.app.halali.customer.entity.Cart;
import com.swind.fast.modules.app.halali.customer.service.ICartService;
import com.swind.fast.modules.app.halali.customer.entity.Order;
import com.swind.fast.modules.app.halali.customer.service.IOrderService;

import com.swind.fast.modules.app.halali.customer.entity.OrderItem;
import com.swind.fast.modules.app.halali.customer.entity.RestaurantMeal;
import com.swind.fast.modules.app.halali.customer.service.IRestaurantMealService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import com.swind.fast.common.system.base.controller.SwindController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
// import com.swind.fast.common.aspect.annotation.AutoLog;

import com.swind.fast.modules.system.entity.SysAnnouncement;
import com.swind.fast.modules.system.entity.SysAnnouncementSend;
import com.swind.fast.modules.system.service.ISysAnnouncementSendService;
import com.swind.fast.modules.system.service.ISysAnnouncementService;
import java.util.Optional;
import java.text.DecimalFormat;
import com.swind.fast.modules.app.halali.customer.vo.response.CartPriceVo;

 /**
 * @Description: 餐厅
 * @Author: swind
 * @Date:   2022-01-20
 * @Version: V1.0
 */
// @Api(tags="用户端-购物车")
@RestController
@RequestMapping("/app/customer/cart")
@Slf4j
public class CartController extends SwindController<Cart, ICartService> {
	@Autowired
	private ICartService cartService;

	// @ApiOperation(value="购物车-计算价格v2", notes="购物车-计算价格")
	@PostMapping(value = "/calc")
	public Result<?> calcv2(@RequestBody List<OrderItem> orderItems) {
		CartPriceVo ret = cartService.calcOrder(orderItems);
		return Result.OK("成功！", ret);
	}

}
